package com.assistant.controller;

import com.assistant.pojo.Address;
import com.assistant.pojo.PackagePostGet;
import com.assistant.service.PersonalCentralService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/personal")
public class PersonalCentralController {
    @Autowired
    private PersonalCentralService personalCentralService;


    @PutMapping(value = "updateMessage")
    public int updatePersonCentralyOpenIdC(@RequestBody Address address) {
        return personalCentralService.updatePersonMessage(address);
    }

    @PostMapping("insert")
    public int inertPersonMsgC(@RequestBody Address address) {
        return personalCentralService.insertPersonMsg(address);
    }

    @GetMapping("/showOneMsgs/{openid}")
    public List<Address> showOneMsgsC(@PathVariable("openid") String openid) {
        return personalCentralService.showOneMsgs(openid);
    }

    @PostMapping("/showPostGetPackage")
    public List<PackagePostGet> packageGetPostC(@RequestBody Map<String, String> map) {
        return personalCentralService.packageGetPost(map);
    }

    @RequestMapping("/showOneMsg/{address_id}")
    public Address showOneMsg(@PathVariable int address_id) {
       return personalCentralService.showOneMsg(address_id);

    }
}
